var amqp = require('amqplib/callback_api');
amqp.connect('amqp://localhost', function(err, conn) {
	conn.createChannel(function(err, ch) {
		var q = 'task_queue';
		ch.assertQueue(q, {
			durable: true
		});

		// simulate 
		var i = 1;
		var msg;
		setInterval(function() {
			msg = i + ' Hello';
			ch.sendToQueue(q, new Buffer(msg), {
				persistent: true
			});
			console.log(" [x] sent %s", msg);
			i++;
		}, 1000);
	})
});


